#include "myitem.h"

#include <QtGui>
#include "ktv/gui/list/mylist.h"

MyItem::MyItem(QGraphicsItem *parent)
    : QGraphicsObject(parent)
{
    width = 400;
    height = 300;
    pixmapLocation = "";
    backgroundPixmap = 0;
}

QRectF MyItem::boundingRect() const
{
    return QRectF(-width/2.0, -height/2.0, width, height);
}

void MyItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
    Q_UNUSED(option);
    Q_UNUSED(widget);
    if (backgroundPixmap != 0) {
        painter->drawPixmap(-width / 2.0, -height / 2.0, width, height, *backgroundPixmap);
    }
}

void MyItem::setPixmapLocation(QString l)
{
    pixmapLocation=l;
    backgroundPixmap = new QPixmap(l);
}
